import React from 'react'
import ReactDOM from 'react-dom'
import { ConfigProvider } from 'antd'
import zhCN from 'antd/es/locale/zh_CN' 
import {
  BrowserRouter as Router,
  Switch,
  Route,
  Redirect
} from 'react-router-dom'
import 'antd/dist/antd.less'
import App from './App'
import { whiteListRoutes } from './routes'
import Userslist from './views/users/userslist'

ReactDOM.render(
  <ConfigProvider locale={zhCN}>
    <Router>
      <Switch>
        <Route path="/admin" component={ App } />
        {
          whiteListRoutes.map(route => (
            <Route key={route.path} path={ route.path } component={ route.component } />
          ))
        }
           <Route  path='admin/users/userslist' component={Userslist}> </Route>
        <Redirect from="/" to="/admin" exact />
        <Redirect to="/404" />
      </Switch>
    </Router>
  </ConfigProvider>,
  document.getElementById('root')
)
